package chunmap.app;

import java.awt.Graphics;

import javax.swing.JApplet;

import chunmap.raster.gmap.GMLayer;
import chunmap.view.layer.Layer;

public class MapApplet extends JApplet{
	private static final long serialVersionUID = 2699544260089397190L;

	private MapCtrl map;
	
	@Override
	public void init(){
		super.init();
		map=new MapCtrlImpl(this);
		initMap(map);
	}
	
	@Override
	public void paint(Graphics g)
	{
		g.drawImage(map.getBufferImage(), 0, 0, this);
		g.drawString("ChunMap", 2, 15);
	}
	
	protected void initMap(MapCtrl map) {
		addLayer(map);
		map.fullView();
		map.refreshMap();
	}
	
	protected void addLayer(MapCtrl map) {
		Layer layer = new GMLayer();
		map.getLayerCollection().add(layer);
//		String url="http://localhost:8080/chunmapService/test?SERVICE=GoogleMap";
//		Layer layer = new GMLayer(url);
//		map.getLayerCollection().add(layer);
	}
}
